package cn.autumnorange.app.snowflake.provider.service;

import cn.autumnorange.app.common.dto.ResultDto;
import cn.autumnorange.app.snowflake.api.SnowFlakeService;
import cn.izern.sequence.Sequence;
import org.springframework.context.annotation.Primary;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

@Primary
@Service
public class SnowFlakeServiceImpl implements SnowFlakeService {

  @Override
  public ResponseEntity<ResultDto<Long>> getGlobalId() {
    return ResponseEntity.ok(ResultDto.createDataResult(Long.valueOf(new Sequence().nextId())));
  }

  @Override
  public ResponseEntity<ResultDto> test(HttpServletRequest request) {
    return null;
  }
}
